<div class="container">
    <h1 id="pkg-overview">package sha1</h1>
    <p><code>import "crypto/sha1"</code>
    </p><p>sha1包实现了SHA1哈希算法，参见<a href="http://tools.ietf.org/html/rfc3174">RFC 3174</a>。</p>
    
    
		
        
        
        
    
    
    
		
        
        
    
    <h2 id="pkg-constants">Constants </h2>
    <pre>const <span id="BlockSize">BlockSize</span> = 64</pre>
    <p>SHA1的块大小。</p>
    <pre>const <span id="Size">Size</span> = 20</pre>
    <p>SHA1校验和的字节数。</p>
    <h2 id="Sum">func <a href="https://github.com/golang/go/blob/master/src/crypto/sha1/sha1.go?name=release#125" title="View Source">Sum</a> </h2>
    <pre class="funcdecl">func Sum(data []<a href="builtin.htm#byte">byte</a>) [<a href="#Size">Size</a>]<a href="builtin.htm#byte">byte</a></pre>
    <p>返回数据data的SHA1校验和。</p>
    <div class="panel-group">
        <div class="panel panel-default" id="example-Sum">
            <div class="panel-heading" onclick="document.getElementById('ex-Sum').style.display = document.getElementById('ex-Sum').style.display=='none'?'block':'none';">Example</div>
            <div class="panel-collapse collapse" id="ex-Sum">
                <div class="panel-body">
                    <pre>data := []byte("This page intentionally left blank.")
fmt.Printf("% x", sha1.Sum(data))</pre>
                    <p>Output:
                    </p><pre>af 06 49 23 bb f2 30 15 96 aa c4 c2 73 ba 32 17 8e bc 4a 96
</pre>
                </div>
            </div>
        </div>
    </div>
    <h2 id="New">func <a href="https://github.com/golang/go/blob/master/src/crypto/sha1/sha1.go?name=release#51" title="View Source">New</a> </h2>
    <pre class="funcdecl">func New() <a href="hash.htm">hash</a>.<a href="hash.htm#Hash">Hash</a></pre>
    <p>返回一个新的使用SHA1校验的hash.Hash接口。</p>
    <div class="panel-group">
        <div class="panel panel-default" id="example-New">
            <div class="panel-heading" onclick="document.getElementById('ex-New').style.display = document.getElementById('ex-New').style.display=='none'?'block':'none';">Example</div>
            <div class="panel-collapse collapse" id="ex-New">
                <div class="panel-body">
                    <pre>h := sha1.New()
io.WriteString(h, "His money is twice tainted:")
io.WriteString(h, " 'taint yours and 'taint mine.")
fmt.Printf("% x", h.Sum(nil))</pre>
                    <p>Output:
                    </p><pre>59 7f 6a 54 00 10 f9 4c 15 d7 18 06 a9 9a 2c 87 10 e7 47 bd
</pre>
                </div>
            </div>
        </div>
    </div>
</div>